<template>
  <h1>我是App组件</h1>
  <h3>姓名:{{ person.name }}</h3>
  <h3>年龄:{{ person.age }}</h3>
  <button @click="emitEvent">触发自定义事件</button>
</template>

<script>
import { reactive } from "vue";
export default {
  name: "Demo",
  props: ["msg"],
  emits: ["hello"],
  setup(props, context) {
    console.log(props, context);
    console.log(context.slots);
    let person = reactive({
      name: "张三",
      age: 18,
    });
    function emitEvent() {
      context.emit("hello", "树哥");
    }
    return {
      person,
      emitEvent,
    };
  },
};
</script>

<style></style>
